package com.haima.sage.bigdata.api.entity.api;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter(autoApply = true)
public class ResultTypeConvert implements AttributeConverter<ResultType, String> {
    @Override
    public String convertToDatabaseColumn(ResultType attribute) {
        return attribute.toString();
    }

    @Override
    public ResultType convertToEntityAttribute(String dbData) {
        if (dbData == null) {
            return null;
        }
        return ResultType.getInstance(dbData);
    }
}